import request from './request.js'

const key = '4ac66900311a39fcfdf76cd028e9c770'

//根据IP获取自身所在城市信息
export const getCityByIP = () => {
    return request({
        method: 'get',
        url: `/ip?key=${key}`,
    })
}

//根据城市名称获取城市adcode
export const getAdcodeByCity = (name) => {
    return request({
        method: 'get',
        url: `geocode/geo?address=${name}&key=${key}`,
    })
}

//根据城市adcode获取实时天气信息
export const getBaseWeatherByAdcode = (value) => {
    return request({
        method: 'get',
        url: `/weather/weatherInfo?city=${value}&extensions=base&key=${key}`,
    })
}

//根据城市代码获取全部天气信息
export const getAllWeatherByAdcode = (value) => {
    return request({
        method: 'get',
        url: `/weather/weatherInfo?city=${value}&extensions=all&key=${key}`,
    })
}


